package com.u.tool;

import java.util.List;

import com.u.eventInfo.Event;
import com.u.eventInfo.EventInfo;
import com.u.eventInfo.EventLog;

public class EventStatusUtil {
	 public static Boolean ChangeEventStatus(String eventid, String method) {
		 String sql = "select * from y_r.event where event_id="+eventid;
		 System.out.println(sql);
		 MysqlUtil db = new MysqlUtil();
		 db.connection();
		 List<Event> list =  db.query(Event.class, sql);
		 Event event = list.get(0);
		 if(event.getStatus().equals("uploaded")) {
			 event.setStatus("received");
		 }
		 switch(method) {
		 case("repair"):{
			 event.setStatus("repairing");
			 break;
		 }
		 case("complete"):{
			 event.setStatus("completed");
			 break;
		 }
		 default:break;
		 }
		 db.update(event);
		 return true;
	 }
}
